<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>文档在线预览</title>
    <link type="text/css" href="css/base.css" rel="stylesheet" />
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/flexpaper.css"/>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/flexpaper.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/flexpaper_handlers.js"></script>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/menu.js"></script>
</head>

<body>
<%@ include file="/page/share/menu.jsp" %>

    <div id="content">
        <h2>文件预览</h2><a href="#" onclick="window.history.go(-1);" onMouseOver="this.style.color='red'" onmouseout="this.style.color='#ffffff'"
                        style="text-decoration:none; text-align:center;vertical-align:middle;float: right; margin: -30px 40px 0px 0px;width: 80px;line-height:25px;height: 25px;color:white;font-size: 16px;border: none; vertical-align: bottom;">返回</a>
        <hr>
        <div style="padding: 10px 100px;" >
            <div id="documentViewer" class="flexpaper_viewer" style="width:770px;height:500px"></div>

            <script type="text/javascript">
                /*function getDocumentUrl(document) {
                 return "php/services/view.php?doc={doc}&format={format}&page={page}".replace("{doc}", document);
                 }*/

                var startDocument = "Paper";

                $('#documentViewer').FlexPaperViewer(
                        { config: {
                            SWFFile: "${fileName}",
                            Scale: 0.6,
                            ZoomTransition: 'easeOut',
                            ZoomTime: 0.5,
                            ZoomInterval: 0.2,
                            FitPageOnLoad: true,
                            FitWidthOnLoad: false,
                            FullScreenAsMaxWindow: false,
                            ProgressiveLoading: false,
                            MinZoomSize: 0.2,
                            MaxZoomSize: 5,
                            SearchMatchAll: false,
                            InitViewMode: 'Portrait',
                            RenderingOrder: 'flash',
                            StartAtPage: '',

                            ViewModeToolsVisible: true,
                            ZoomToolsVisible: true,
                            NavToolsVisible: true,
                            CursorToolsVisible: true,
                            SearchToolsVisible: true,
                            WMode: 'window',
                            localeChain: 'en_US'
                        }}
                );
            </script>
        </div>
    </div>

    <div id="footer">
        <p style="text-align: center;color: #757575;padding: 20px 0px 0px 0px; font:12px;">Copyright © 2010-2013 蓝天白云团队 版权所有</p>
    </div>



<script type="text/javascript">
    var url = window.location.href.toString();

    if (location.length == 0) {
        url = document.URL.toString();
    }

    if (url.indexOf("file:") >= 0) {
        jQuery('#documentViewer').html("<div style='position:relative;background-color:#ffffff;width:420px;font-family:Verdana;font-size:10pt;left:22%;top:20%;padding: 10px 10px 10px 10px;border-style:solid;border-width:5px;'>&nbsp;" +
                "<b>你正在尝试本地浏览.</b><br/><br/>" +
                " 文档预览需要复制到web服务器上运行<br/><br/>" +
                "请复制到web服务器上通过http://访问.</div>");
    }
</script>

</body>
</html>
